package com.huahai.controller;

import com.huahai.entity.Product;
import com.huahai.service.IProductService;
import com.huahai.service.impl.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {

    @Autowired
    IProductService service;
    
    @GetMapping("product/{pid}")
    public Product searchProduct(@PathVariable("pid") int pid){
        Product product = service.getProductById(pid);
        return product;
    }
}
